﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Marbles.Core.BBS;

namespace Marbles.Web.BBS
{
    public partial class ForumList : Marbles.Core.Content.UserControl
    {

        private string category = string.Empty;
        private ForumCollection items = null;

        protected void Page_Load(object sender, EventArgs e)
        {
            this.items = new ForumCollection(this.CurrentWeb.SiteId);
            cRptLstFora.DataSource = this.items.Categories;
            cRptLstFora.DataBind();
        }

        protected void cRptLstFora_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            KeyValuePair<string, string> key = (KeyValuePair<string, string>)e.Item.DataItem;
            ListView cLstFora = e.Item.FindControl("cLstFora") as ListView;
            cLstFora.DataSource = items.GetForumByCategory(key.Key);
            cLstFora.DataBind();
        }
    }
}